<?php

namespace XWAM\Addon\PXCallSystem\Model;

/**
 * 系统历史记录模型
 *
 * @version 1.0
 * @since 1.0.0 <2015-03-26> SoChishun Added.
 */
class SysHistoryModel {

    /**
     * 添加浏览记录
     * @param int $uid 用户编号
     * @param string $title 标题
     * @param string $url 路径
     * @since 1.0 <2015-3-26> SoChishun Added.
     */
    public function add_visit_history($uid, $title, $url) {
        $key = 'History/visit_history_' . $uid;
        $list = F($key);
        $list[$title] = $url;
        if (count($list) > 10) {
            array_shift($list);
        }
        F($key, $list);
    }

    /**
     * 返回浏览记录列表
     * @param int $uid 用户编号
     * @return array 返回一维数组(键值)
     * @since 1.0 <2015-3-26> SoChishun Added.
     */
    public function get_visit_history($uid) {
        $key = 'History/visit_history_' . $uid;
        return F($key);
    }

}
